#ifndef SSXSTACK_H_INCLUDED
#define SSXSTACK_H_INCLUDED
#include<iostream>
template<typename Object>
class SsxStack{

public:

    explicit SsxStack(int capacity):topOfStack(-1),m_capacity(capacity){theArray = new Object[capacity];}

    virtual ~SsxStack()
    {

        delete theArray;
        theArray = 0;
    }

    void push(Object & x){
        if(topOfStack < m_capacity - 1)
            theArray[++topOfStack] = x;
        else{
            std::cout << "Stack is full!" << std::endl;
        }
    }


    void pop(){

        if(topOfStack > -1)
        {
            --topOfStack;

        }
        else{
            std::cout << "Empty Stack" << std::endl;
        }

    }


    Object & top(){

        if(topOfStack > -1)
            return theArray[topOfStack];
        else{
            std::cout << "Empty Stack" << std::endl;

        }


    }


    int stackSize()
    {
        return topOfStack + 1;
    }


private:

    Object * theArray;
    int m_capacity;
    int topOfStack;
};



#endif // SSXSTACK_H_INCLUDED
